NanoBeacon Click
NanoBeacon Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.
Click Library
- Author : Stefan Filipovic
- Date : Aug 2023.
- Type : UART type
Software Support
Example Description
This example demonstrates the use of NanoBeacon Click board by setting the Eddystone URI advertisement to Click boards webpage.
Example Libraries
- MikroSDK.Board
- MikroSDK.Log
- Click.NanoBeacon
Example Key Functions
- nanobeacon_cfg_setup Config Object Initialization function.
void nanobeacon_cfg_setup(nanobeacon_cfg_t *cfg)
NanoBeacon configuration object setup function.
NanoBeacon Click configuration object.
Definition nanobeacon.h:174
- nanobeacon_init Initialization function.
err_t nanobeacon_init(nanobeacon_t *ctx, nanobeacon_cfg_t *cfg)
NanoBeacon initialization function.
NanoBeacon Click context object.
Definition nanobeacon.h:152
- nanobeacon_set_advertising This function sets the device MAC address, interval and advertising raw data.
err_t nanobeacon_set_advertising(uint8_t *mac_address, uint16_t interval, uint8_t *adv_raw_data, uint8_t len)
NanoBeacon set advertising function.
- nanobeacon_load_adv_to_ram This function loads advertising data to RAM.
err_t nanobeacon_load_adv_to_ram(nanobeacon_t *ctx)
NanoBeacon load adv to ram function.
- nanobeacon_start_advertising This function starts the advertising.
err_t nanobeacon_start_advertising(nanobeacon_t *ctx)
NanoBeacon start advertising function.
Application Init
Initializes the driver and logger.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
#define NANOBEACON_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition nanobeacon.h:125
void application_init(void)
Definition main.c:33
Application Task
Every 10 seconds, it restarts and configures the device for advertisement with the Eddystone URI beacon format set to Click boards webpage: https://www.mikroe.com/click
{
static uint8_t mac_address[ 6 ] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
static uint8_t eddystone_adv_raw[ ] =
{
0x03,
0x03,
0xAA, 0xFE,
0x12,
0x16,
0xAA, 0xFE,
0x10,
0x00,
0x01,
'm','i','k','r','o','e',
0x00,
'c','l','i','c','k'
};
log_printf( &logger, "\r\n Restart device\r\n" );
{
log_error( &logger, " Check communication." );
Delay_ms ( 1000 );
}
log_printf( &logger, " Configure device for advertisement\r\n" );
sizeof( eddystone_adv_raw ) ) )
{
log_error( &logger, " Set advertising." );
}
{
log_error( &logger, " Load data to RAM." );
}
log_printf( &logger, " Start advertising\r\n" );
{
log_error( &logger, " Start advertising." );
}
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
void nanobeacon_restart_device(nanobeacon_t *ctx)
NanoBeacon restart device function.
err_t nanobeacon_check_communication(nanobeacon_t *ctx)
NanoBeacon check communication function.
void application_task(void)
Definition main.c:63
@ NANOBEACON_OK
Definition nanobeacon.h:199
Note
During advertising, the Click board should appear as an Eddystone URI beacon on the BLE Scanner application.
Application Output
This Click board can be interfaced and monitored in two ways:
- Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
- UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Additional Notes and Information
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.